package com.wlcorp.forcazamis.dao.baseinfo.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.ibatis.dao.client.DaoException;
import com.wlcorp.forcazamis.dao.baseinfo.ISampleSourceDAO;
import com.wlcorp.forcazamis.domain.baseinfo.SampleSource;

public class SampleSourceDAOImpl extends HibernateDaoSupport implements
		ISampleSourceDAO {

	@SuppressWarnings("unchecked")
	public List getSampleSourceList(SampleSource sampleSource)
			throws DaoException {
		return getHibernateTemplate().find("from SampleSource as s where s.deleteFlag=false");
	}

	public SampleSource getSampleSourceById(Long sampleSourceId)
			throws DaoException {
		return (SampleSource)getHibernateTemplate().get(SampleSource.class,sampleSourceId);
	}

	public void deleteSampleSource(SampleSource sampleSource)
			throws DaoException {
		sampleSource.setDeleteFlag(true);
		getHibernateTemplate().update(sampleSource);
	}

	public void saveSampleSource(SampleSource sampleSource) throws DaoException {
		getHibernateTemplate().saveOrUpdate(sampleSource);
	}

}
